﻿using System.Data.Entity;
using NPMonitor.Configuration;
using NPMonitor.DataModel;
using NPMonitor.DataModel.Users;
using NPMonitor.Helpers;
using NPMonitor.Interfaces;

namespace NPMonitor.Implementation.Internal
{
    public class DbStoreContext : DbContext
    {
        public DbStoreContext()
            :this((IEFJobStoreSettingsProvider)Utils.CreateInstanceWithRequiredInterface(ConfigurationSettings.SettingsProvider.JobStoreSettingsProviderType.AssemblyQualifiedName, "IEFJobStoreSettingsProvider"))
        {
        }

        protected DbStoreContext(IEFJobStoreSettingsProvider jobStoreSettingsProvider)
            :this(jobStoreSettingsProvider.ConnectionString)
        {
        }

        protected DbStoreContext(string connectionString)
            : base(connectionString)
        {
        }

        public DbSet<JobData> Jobs { get; set; }
        public DbSet<Alert> Alerts { get; set; }
        public DbSet<JobExecutionHistory> JobExecutionHistory { get; set; }
        public DbSet<MachineData> Machines { get; set; }
        public DbSet<MachinePool> MachinePool { get; set; }
        public DbSet<JobDefinition> JobDefinitions { get; set; }
        public DbSet<WorkflowJobData> WorkflowJobs { get; set; }
        public DbSet<Scenario> Scenarios { get; set; }
        public DbSet<WorkflowData> Workflows { get; set; }
        public DbSet<NotificationData> Notifications { get; set; }
        public DbSet<Users> User { get; set; }
        public DbSet<MailData> Mails { get; set; }
        public DbSet<vDailyViewData> DailyReport { get; set; }
        public DbSet<HttpActionRequestsData> HttpActionRequests { get; set; }
        public DbSet<HttpActionData> HttpActions { get; set; }

    }
}
